package com.yl.googleplayer_yl.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.yl.googleplayer_yl.R;
import com.yl.googleplayer_yl.fragment.FragmentFactory;
import com.yl.googleplayer_yl.utils.CommonUtils;

/**
 * Created by Administrator on 2016/10/30 0030.
 */

public class MainAdapter extends FragmentPagerAdapter {

    private final String[] tabs;

    public MainAdapter(FragmentManager fm) {
        super(fm);
        tabs = CommonUtils.getArray(R.array.tab_names);
    }

    @Override
    public Fragment getItem(int position) {

        return FragmentFactory.create(position);
    }

    @Override
    public int getCount() {
        return tabs.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabs[position];

    }
}
